// 实现关键字查询功能

function search() {
    // 获取关键字
    let keyword = $("#searchbox").val();
    if(keyword.trim() == "" || keyword == null || keyword == undefined){
        window.location.href = "/";
        return;
    }
    window.location.href = "/search/" + keyword;
}

// 选择标签，查看文章
function queryForTagId() {
    let tagId;
    let obj_lis = document.getElementById("tag").getElementsByTagName("li");
    for(let i=0;i<obj_lis.length;i++){
        obj_lis[i].onclick = function(){
            tagId = $(this).find("[name='tagId']").val();
            window.location.href = "/queryForTagId/" + tagId;
        }
    }
}

// 选择分类，查看文章
function queryForCategoryId() {
    let categoryId;
    let obj_lis = document.getElementById("category").getElementsByTagName("li");
    for(let i=0;i<obj_lis.length;i++){
        obj_lis[i].onclick = function(){
            categoryId = $(this).find("[name='categoryId']").val();
            window.location.href = "/queryForCategoryId/" + categoryId;
        }
    }
}


